package com.hx.mapper;

import com.hx.entity.Test;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author qizhu
 * @since 2022-06-24
 */
@Mapper
public interface TestMapper extends BaseMapper<Test> {
    //@MapKey("")//通过@MapKey定义返回Map集合的key是哪个字段的值，Map集合的Value则为每行数据的值
    List<Map<String, String>> getAllData(String tableName);
   /* List<Map<String, String>> getAllData(@Param("tableName") String tableName,@Param("page") Integer page,
                                        @Param("limit") Integer limit);*/

    //关联查询
    List<Map<String, String>> getAssociatedQueryDataLeft(@Param("tableNameOne") String tableNameOne,@Param("tableNameTwo") String tableNameTwo,
                                                     @Param("fieldOne") String fieldOne,@Param("fieldTwo") String fieldTwo);

    String[] getAllTableName();

    String[] getAllTableFiled(@Param("tableName") String tableName);

    void deleteByTableNames(@Param("tableName") String tableName);

    void removeDataBytableName(@Param("tableName") String tableName);

    List getAssociatedQueryDataRight(String tableNameOne, String tableNameTwo, String fieldOne, String fieldTwo);

    List getAssociatedQueryData(String tableNameOne, String tableNameTwo, String fieldOne, String fieldTwo);

    List getTableData(@Param("datasourceNmae")String datasourceNmae);

    Test getAllTest(@Param("id") Integer id);
}
